home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / UIFlow 1.0.1 / UIFlow Source / VSet2.0 / Src / eg1.f < prev    next >
Encoding:
Text File  |  1992-04-20  |  3.2 KB  |  119 lines  |  [TEXT/????]

  1. c  ==================================================================    
  2. c
  3. c    EG1.F
  4. c    HDF VSET Sample Program
  5. c
  6. c    Creates a vset of 1 vgroup and 2 vdatas into the file 'eg1.hdf'.
  7. c    The companion program VSETR.F reads from this file.
  8. c
  9. c    compile and link
  10. c    compile to get the object file 'eg1.o'
  11. c    link 'eg1.o' with the libraries 'libvg.a' and 'libdf.a'
  12. c
  13. c    ==================================================================
  14. c     
  15. c                  NCSA HDF Vset release 2.0
  16. c                    December, 1990
  17. c                Jason NG NCSA 15-DEC-90
  18. c    
  19. c     NCSA HDF Vset release 2.0 source code and documentation are in the public
  20. c     domain.  Specifically, we give to the public domain all rights for future
  21. c     licensing of the source code, all resale rights, and all publishing rights.
  22. c     
  23. c     We ask, but do not require, that the following message be included in all
  24. c     derived works:
  25. c     
  26. c     Portions developed at the National Center for Supercomputing Applications at
  27. c     the University of Illinois at Urbana-Champaign.
  28. c     
  29. c     THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  30. c     SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  31. c     WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  32. c     
  33. c    ==================================================================
  34.  
  35.     program SAMPLE
  36.  
  37.     integer    buf(100), sbuf(100), i,n
  38.     integer f
  39.  
  40.     external DFOPEN, DFCLOSE
  41.     external VSFATCH, VSFDTCH, VSFSFLD, VSFSNAM, VSFWRIT 
  42.     external VSFFDEF
  43.     external VFATCH, VFDTCH, VFSNAM, VFINSRT 
  44.     integer    DFOPEN
  45.     integer  VSFATCH, VSFSFLD, VSFWRIT, VSFFDEF
  46.     integer  VFATCH, VFINSRT
  47.  
  48.     integer  vs, vg
  49.  
  50. c    some defined constants. see "vg.h"
  51.  
  52.     integer INTTYPE                
  53.     parameter (INTTYPE=2)
  54.     integer    FINTRLACE
  55.     parameter (FINTRLACE=0)
  56.  
  57.     integer FULLACC    
  58.     parameter (FULLACC=7)
  59.  
  60. c    ------ generate data -------
  61.     do 111 i=1,100
  62.         buf(i) = i+500
  63.         sbuf(i) = i+7000
  64. 111    continue
  65.  
  66.  
  67. c    ------ write to vset -------
  68.  
  69. c    --- (A) ----
  70. c    --- open HDF file, attach to new vgroup
  71. c    --- name the vgroup 'my_fortran_vgroup'
  72.  
  73. c    --- (B) ----
  74. c    --- attach to new (1st) vdata, name it 'the_fortune_500_vdata'
  75. c    --- write out 20 integers from buf as the predefined field 'IY'
  76. c    --- tell VSFWRIT your data is fully-interlaced.
  77. c    --- insert the vdata into the above vgroup
  78. c    --- when done, detach the vdata.
  79.  
  80. c    --- (C) ---
  81. c    --- attach to new (2nd)  vdata, name it 'the-famous-sevens'
  82. c    --- define your own new field 'SIEBEN' type integer.
  83. c    --- write out 70 integers from buf as the field 'SIEBEN'
  84. c    --- tell VSFWRIT your data is fully-interlaced.
  85. c    --- insert the vdata into the above vgroup
  86. c    --- when done, detach the vdata.
  87.  
  88. c    --- (D) ---
  89. c    --- finally detach the vgroup and close the file
  90.  
  91. c    --- (A) ----
  92.     f = DFOPEN ('eg1.hdf', FULLACC, 0)
  93.     vg = VFATCH (f, -1,'w')
  94.     call VFSNAM(vg, 'my_fortran_group')
  95.  
  96. c    --- (B) ----
  97.     vs = VSFATCH (f, -1,'w')
  98.     call VSFSNAM(vs, 'the_fortune_500_vdata')
  99.     n = VSFSFLD (vs, 'IY')
  100.     n = VSFWRIT (vs, buf,20, FINTRLACE)
  101.     n = VFINSRT (vg, vs)
  102.     call VSFDTCH (vs)
  103.  
  104. c    --- (C) ---
  105.     vs = VSFATCH (f, -1,'w')
  106.     call VSFSNAM(vs, 'the-famous-sevens')
  107.     n = VSFFDEF (vs, 'SIEBEN',INTTYPE,1)
  108.     n = VSFSFLD (vs, 'SIEBEN')
  109.     n = VSFWRIT (vs, sbuf,70, FINTRLACE)
  110.     n = VFINSRT (vg, vs)
  111.     call VSFDTCH (vs)
  112.  
  113. c    --- (D) ---
  114.     call VFDTCH (vg)
  115.     call DFCLOSE (f)
  116.  
  117.     end
  118.  
  119.